package com.cskaoyan.service.vx;


import com.cskaoyan.bean.po.wxPo.MarketFeedback;
import com.cskaoyan.bean.po.wxPo.MarketUser;
import com.cskaoyan.bean.vo.vxVo.WxFeedBackVO;
import com.cskaoyan.mapper.wxMapper.MarketFeedbackMapper;
import org.apache.shiro.SecurityUtils;
import org.apache.shiro.subject.Subject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;

@Service
public class WxFeedBackServiceImpl implements WxFeedBackService{

    @Autowired
    MarketFeedbackMapper marketFeedbackMapper;

    @Override
    public void getSubmit(WxFeedBackVO wxFeedBackVO) {
        MarketFeedback wxFeedBackVO1 = new MarketFeedback();
        Subject subject = SecurityUtils.getSubject();
        MarketUser marketUser = (MarketUser) subject.getPrincipals().getPrimaryPrincipal();
        Integer userId = marketUser.getId();
        wxFeedBackVO1.setContent(wxFeedBackVO.getContent());
        wxFeedBackVO1.setFeedType(wxFeedBackVO.getFeedType());
        wxFeedBackVO1.setHasPicture(wxFeedBackVO.isHasPicture());
        wxFeedBackVO1.setMobile(wxFeedBackVO.getMobile());
        wxFeedBackVO1.setPicUrls(wxFeedBackVO.getPicUrlsString());
        wxFeedBackVO1.setUserId(userId);
        wxFeedBackVO1.setAddTime(new Date());
        wxFeedBackVO1.setUpdateTime(new Date());
       int count = marketFeedbackMapper.insertSubmit(wxFeedBackVO1);
    }
}
